package exam10;

import java.util.ArrayList;
import java.util.Iterator;

/**
 * @author HB
 * @version 1.0
 * @description
 * @date 2021/6/30
 */
public class BuyBasket {
    private ArrayList list=new ArrayList();

    public void accept(Visitor visitor){
        Iterator i=list.iterator();

        while(i.hasNext()){
            ((Product)i.next()).accept(visitor);
        }
    }

    public void addProduct(Product product){
        list.add(product);
    }

    public void removeProduct(Product product){
        list.remove(product);
    }
}

